import java.io.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.Scanner;

public class Main implements Format {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		Event event = new Event();
		String s, tmp = "";
		Integer i;
		Date dat;
		do {
			System.out.print("��������� ��������� ��䳿?(y/n) ");
			s = sc.nextLine();
		} while (!(s.equals("n") || s.equals("y")));
		if (s.equals("n")) {
			System.out.println("������ ����:");
			System.out.print("�����:");
			tmp += sc.nextLine();
			System.out.print("̳����:");
			tmp = sc.nextLine() + "/" + tmp;
			System.out.print("г�:");
			tmp = tmp + "/" + sc.nextLine();
			dat = new Date(tmp);
		} else
			dat = new Date();
		System.out.println("\n" + format.format(dat) + ":");
		try {
			BufferedReader out = new BufferedReader(new InputStreamReader(
					new FileInputStream("C:\\Events.txt")));

			while ((s = out.readLine()) != null) {
				i = 0;
				tmp = "";
				do
					i++;
				while (s.charAt(i + 1) != ' ');
				for (int j = 0; j <= i; j++)
					tmp += s.charAt(j);
				event.setDate(format.parse(tmp));
				tmp = "";
				for (int j = i + 4; j < s.length(); j++)
					tmp += s.charAt(j);
				event.setDescription(tmp);
				if (format.format(dat).equals(format.format(event.getDate())))
					System.out.println("-" + event.getDescription());
			}
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
